home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume18 / elm2.2 / part10 < prev    next >
Encoding:
Internet Message Format  |  1989-04-12  |  48.6 KB

  1. Subject:  v18i089:  Elm mail system, release 2.2, Part10/24
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: dsinc!syd@uunet.UU.NET (Syd Weinstein)
  7. Posting-number: Volume 18, Issue 89
  8. Archive-name: elm2.2/part10
  9.  
  10. #!/bin/sh
  11. # this is part 10 of a multipart archive
  12. # do not concatenate these parts, unpack them in order with /bin/sh
  13. # file hdrs/shortname.1 continued
  14. #
  15. CurArch=10
  16. if test ! -r s2_seq_.tmp
  17. then echo "Please unpack part 1 first!"
  18.      exit 1; fi
  19. ( read Scheck
  20.   if test "$Scheck" != $CurArch
  21.   then echo "Please unpack part $Scheck next!"
  22.        exit 1;
  23.   else exit 0; fi
  24. ) < s2_seq_.tmp || exit 1
  25. echo "x - Continuing file hdrs/shortname.1"
  26. sed 's/^X//' << 'SHAR_EOF' >> hdrs/shortname.1
  27. XReceived: by convex (4.12/4.7)
  28. X    id AA01616; Tue, 24 Mar 87 16:47:43 cst
  29. XReceived: by ndmce.UUCP (smail2.3)
  30. X    id AA24491; 24 Mar 87 16:41:30 CST (Tue)
  31. XTo: ndmce!hplabs!taylor@hplabs.HP.COM
  32. XDate: Tue, 24 Mar 87 16:08:01 CST
  33. XSubject: shortnames.h mods
  34. XX-Mailer: Elm [version 1.5]
  35. X
  36. XDave,
  37. X
  38. XHello. I have just finished installing Elm on my 68k unix box running
  39. XUnisoft Uniplus+ sysvr1. Unfortunately the C compiler doesn't support
  40. Xlong variable names so I had the dubious honor of updating shortnames.h
  41. Xto include several new variable and function names. I also do not have
  42. Xthe setvbuf() function. I modified filter.h to delete it. I am enclosing
  43. Xmy changes if you are interested...
  44. X
  45. XManlio D. Marquez
  46. Xjlsoft!marquez
  47. X
  48. X
  49. X
  50. Xshortnames.h
  51. X-----------------------
  52. X/**            shortnames.h            **/
  53. X
  54. X/** This file is from Geoff Kuenning, and will help those poor users that
  55. X    are stuck using C compilers that don't have flexnames.   Too bad.
  56. X
  57. X    This file has no explicit copyright.
  58. X
  59. X**/
  60. X
  61. X#define PutLine0        PLine0
  62. X#define PutLine1        PLine1
  63. X#define PutLine2        PLine2
  64. X#define PutLine3        PLine3
  65. X
  66. X#define add_to_table        add_2_table
  67. X#define address1        addrs1
  68. X#define addressII        addrsII
  69. X#define addresses        addr_s
  70. X#define alternate_prompt    alt_prompt
  71. X#define alternative_addresses    alt_addrs
  72. X#define alternatives        alts
  73. X#define always_leave        alw_leave
  74. X
  75. X#define calendar_line        cal_line
  76. X#define cancelled_msg        cncld_msg
  77. X#define central_message_buffer    cntrl_bfr
  78. X#define check_form_file        chk_frmf
  79. X#define compare_dates        cmp_dates
  80. X#define compare_headers        cmp_hdrs
  81. X#define copy_message_across    cpy_msg_across
  82. X#define current_record        cur_rec
  83. X#define current_time        cur_time
  84. X
  85. X#define define_softkeys        def_softkeys
  86. X#define display_central_message    displ_cntrl_msg
  87. X#define display_error        displ_error
  88. X#define display_headers        displ_hdrs
  89. X#define display_helpfile    dspl_helpfile
  90. X#define display_line        dspl_line
  91. X#define display_options        displ_options
  92. X#define display_title        displ_titles
  93. X#define display_to        displ_to
  94. X
  95. X#define encrypted        crypted
  96. X#define encrypted_key        crypt_key
  97. X#define expanded_cc        xp_cc
  98. X#define expanded_to        xp_to
  99. X#define expand_address        xp_addr
  100. X#define expand_domain        xp_domain
  101. X#define expand_env        xp_env
  102. X#define expand_filename        xp_filename
  103. X#define expand_group        xp_group
  104. X#define expand_logname        xp_logname
  105. X#define expand_site        xp_site
  106. X#define expand_system        xp_system
  107. X
  108. X#define filename2        fn2
  109. X#define findnode_has_been_initialized    fndhbi
  110. X#define format_long        frm_lng
  111. X#define form_letter        frm_let
  112. X#define forward            forwrd
  113. X
  114. X#define generate_reply_to    gen_reply_to
  115. X#define get_return_name        g_ret_name
  116. X
  117. X#define header_line        h_line
  118. X#define header_page        h_page
  119. X#define headers_per_page    h_per_page
  120. X#define header_table        h_table
  121. X
  122. X#define install_aliases        ins_aliases
  123. X
  124. X#define last_line_loc        last_ln_loc
  125. X#define long_sum        lng_sum
  126. X
  127. X#define machine_group        mach_group
  128. X#define mailbox_defined        mbox_defined
  129. X#define mailfile_size        mfile_size
  130. X#define message_count        msg_count
  131. X#define message_number        msg_number
  132. X
  133. X#define newaliases        nwaliases
  134. X#define noptimize_return    noret_opt
  135. X#define noptimize_usenet    nousenet_opt
  136. X
  137. X#define one_liner        one_lner
  138. X#define optimize_and_add    opt_and_add
  139. X#define optimize_arpa        opt_arpa
  140. X#define optimize_cmplx_arpa    opt_cmplx_arpa
  141. X#define optimize_return        opt_return
  142. X#define optimize_usenet        opt_usenet
  143. X#define optional_arg        opt_arg
  144. X#define optionally_enter    opt_enter
  145. X#define options_help        opt_hlp
  146. X#define original_cc        orig_cc
  147. X#define original_msg_num    orig_msg_num
  148. X#define original_to        orig_to
  149. X
  150. X#define parse_arguments        pars_arguments
  151. X#define parse_arpa_from        prs_arpa_from
  152. X#define password_entry        pw_entry
  153. X#define pattern_enter        pat_enter
  154. X#define pattern_match        pat_match
  155. X#define prompt_for_entry    prpt_ent
  156. X#define prompt_for_sized_entry    prpt_sntry
  157. X#define prompt_for_multiple_entries    prpt_fme
  158. X
  159. X#define read_alias_files    rd_alias_files
  160. X#define read_headers        rd_headers
  161. X#define read_in_file        rd_n_file
  162. X#define read_in_messages    rd_n_mess
  163. X#define read_rc            rd_rc
  164. X#define read_rc_file        rd_rc_file
  165. X#define received_on_machine    rcvd_on_machine
  166. X#define remove_all        rem_all
  167. X#define remove_first_word    rem_1st_word
  168. X#define remove_domains        rem_domains
  169. X#define remove_header        rem_hdr
  170. X#define remove_user        rem_user
  171. X#define remove_through_ch    rem_thru_ch
  172. X#define reply_to_everyone    repl_to_everyone
  173. X#define resolve_received    rslv_received
  174. X
  175. X#define save_option_string    sv_string
  176. X#define save_option_sort    sv_sort
  177. X#define save_option_number    sv_number
  178. X#define save_option_on_off    sv_on_off
  179. X#define save_option_weedlist    sv_weed
  180. X#define save_option_alternatives    sv_alts
  181. X#define show_message        shw_message
  182. X#define show_msg        showmsg
  183. X#define show_msg_tag        sh_msg_tag
  184. X#define size_of_pathfd        sz_of_pathfd
  185. X#define softkeys_off        soft_off
  186. X#define softkeys_on        soft_on
  187. X#define subjectbuffer        subjbuff
  188. X#define subject_matches        subj_matches
  189. X#define switching_to_default    sw_t_def
  190. X#define system_call        sys_call
  191. X#define system_data        sys_data
  192. X#define system_files        sys_files
  193. X#define system_hash_table    sys_hash_table
  194. X#define system_record        sys_record
  195. X
  196. X#define tail_of_string        tl_of_string
  197. X#define talk_to_sys        tlk_to_sys
  198. X#define tempfile        tmpfile
  199. X#define termcap_label        tcap_label
  200. X#define top_of_screen_left    top_left_of_screen
  201. X#define top_of_screen_right    top_right_of_screen
  202. X#define translate_return    xlate_return
  203. X
  204. X#define update_mailtime        upd_mailtime
  205. X#define update_title        upd_title
  206. X#define unexpanded_cc        unexp_cc
  207. X#define unexpanded_to        unexp_to
  208. X
  209. X#define verify_transmission    vfy_xmsn
  210. X
  211. X#define weeding_out        wding_out
  212. X
  213. X---------------------------------------
  214. X
  215. Xextra change for filter.h (stuck at end of file)
  216. X
  217. X---------------------------------------
  218. X
  219. X#ifndef setvbuf
  220. X# define setvbuf(fd,a,b,c)    /* if don't have it, punt it off */
  221. X#endif
  222. X
  223. X---------------------------------------
  224. X
  225. X
  226. X
  227. SHAR_EOF
  228. echo "File hdrs/shortname.1 is complete"
  229. chmod 0444 hdrs/shortname.1 || echo "restore of hdrs/shortname.1 fails"
  230. echo "x - extracting hdrs/shortname.2 (Text)"
  231. sed 's/^X//' << 'SHAR_EOF' > hdrs/shortname.2 &&
  232. XNOTE: This file is obsolete and is not being kept uptodate.  It is provided
  233. Xfor reference only.
  234. X
  235. XSyd Weinstein
  236. XElm Coordinator
  237. X
  238. XFrom seismo!sundc!eli!geller@hplabs.HP.COM  Wed Mar 25 22:15:48 1987
  239. XReceived: from hplabsc (hplabsc.hpl.hp.com) by hpldat ; Wed, 25 Mar 87 22:15:48 pst
  240. XReturn-Path: <seismo!sundc!eli!geller@hplabs.HP.COM>
  241. XReceived: from hplabs.HP.COM by hplabsc ; Wed, 25 Mar 87 22:15:04 pst
  242. XReceived: from seismo.CSS.GOV by hplabs.HP.COM with TCP ; Wed, 25 Mar 87 22:12:56 pst
  243. XReceived: from sundc.UUCP by seismo.CSS.GOV (5.54/1.14) with UUCP 
  244. X    id AA24355; Thu, 26 Mar 87 01:12:39 EST
  245. XFrom: seismo!sundc!eli!geller@hplabs.HP.COM
  246. XReceived: by sundc.uucp (3.2/SMI-3.2)
  247. X    id AA06338; Thu, 26 Mar 87 01:10:15 EST
  248. XDate: Thu, 26 Mar 87 01:10:15 EST
  249. XMessage-Id: <8703260610.AA06338@sundc.uucp>
  250. XDave: 
  251. XTo: hplabs!taylor@hplabs.HP.COM
  252. X
  253. XHere's the shortnames.h stuff I told you about. Hope its helpful -
  254. Xbut you probably don't need it, being that you use a real
  255. Xcompiler...
  256. X
  257. XAlso - has reply.c been posted to mod.sources? I'm looking
  258. Xforward to receiving it. That's the last link I need before
  259. XElm gets up and running.
  260. X
  261. X
  262. X/*
  263. X * D. Geller, 3/12/87
  264. X */
  265. X
  266. X#define alternate_editor        alt_editor
  267. X#define prompt_for_entry        pf_entry
  268. X#define prompt_for_multiple_entries    pf_mult
  269. X#define prompt_for_sized_entry        pf_size
  270. X#define long_summary            lng_sum
  271. X#define options_help            opts_help
  272. X#define save_option_string        svo_string
  273. X#define save_option_sort        svo_sort
  274. X#define save_option_on_off        svo_onoff
  275. X#define save_option_number        svo_numb
  276. X#define save_option_weedlist        svo_weed
  277. X#define save_option_alternatives    svo_alt
  278. X#define form_letter            form_le
  279. X#define form_letter_section        form_sect
  280. X#define one_liner_for            onel_for
  281. X#define switching_to_default        swi_to
  282. X#define findnode_has_been_initialized    fnodhas
  283. X
  284. X/*
  285. X * end of additions by Geller
  286. X */
  287. X
  288. X
  289. SHAR_EOF
  290. chmod 0444 hdrs/shortname.2 || echo "restore of hdrs/shortname.2 fails"
  291. echo "x - extracting hdrs/shortname.h (Text)"
  292. sed 's/^X//' << 'SHAR_EOF' > hdrs/shortname.h &&
  293. X
  294. X/* @(#)$Id: shortname.h,v 2.3 89/03/25 21:45:34 syd Exp $ */
  295. X
  296. X/*******************************************************************************
  297. X *  The Elm Mail System  -  $Revision: 2.3 $   $State: Exp $
  298. X *
  299. X *******************************************************************************
  300. X * Bug reports, patches, comments, suggestions should be sent to:
  301. X *
  302. X *    Syd Weinstein, Elm Coordinator
  303. X *    syd@dsinc.UUCP            dsinc!syd
  304. X *
  305. X *******************************************************************************
  306. X * $Log:    shortname.h,v $
  307. X * Revision 2.3  89/03/25  21:45:34  syd
  308. X * Initial 2.2 Release checkin
  309. X * 
  310. X *
  311. X ******************************************************************************/
  312. X
  313. X/** This file is from Geoff Kuenning, and will help those poor users that
  314. X    are stuck using C compilers that don't have flexnames.   Too bad.
  315. X
  316. XNOTE: This file is obsolete and is not being kept uptodate.  It is provided
  317. Xfor reference only.
  318. X
  319. XSyd Weinstein
  320. XElm Coordinator
  321. X
  322. X**/
  323. X
  324. X#define CleartoEOS        Clear_EOS
  325. X#define CleartoEOLN        Clear_EOLN
  326. X
  327. X#define PutLine0        PLine0
  328. X#define PutLine1        PLine1
  329. X#define PutLine2        PLine2
  330. X#define PutLine3        PLine3
  331. X
  332. X#define add_to_table        add_2_table
  333. X#define address1        addrs1
  334. X#define addressII        addrsII
  335. X#define addresses        addr_s
  336. X#define alternate_prompt    alt_prompt
  337. X#define alternative_addresses    alt_addrs
  338. X#define always_leave        alw_leave
  339. X
  340. X#define calendar_line        cal_line
  341. X#define cancelled_msg        cncld_msg
  342. X#define central_message_buffer    cntrl_bfr
  343. X#define compare_dates        cmp_dates
  344. X#define compare_headers        cmp_hdrs
  345. X#define copy_message_across    cpy_msg_across
  346. X#define current_record        cur_rec
  347. X#define current_time        cur_time
  348. X
  349. X#define define_softkeys        def_softkeys
  350. X#define display_central_message    displ_cntrl_msg
  351. X#define display_error        displ_error
  352. X#define display_headers        displ_hdrs
  353. X#define display_helpfile    dspl_helpfile
  354. X#define display_options        displ_options
  355. X#define display_title        displ_titles
  356. X#define display_to        displ_to
  357. X
  358. X#define encrypted        crypted
  359. X#define encrypted_key        crypt_key
  360. X#define expanded_cc        xp_cc
  361. X#define expanded_to        xp_to
  362. X#define expand_address        xp_addr
  363. X#define expand_domain        xp_domain
  364. X#define expand_env        xp_env
  365. X#define expand_filename        xp_filename
  366. X#define expand_group        xp_group
  367. X#define expand_logname        xp_logname
  368. X#define expand_site        xp_site
  369. X#define expand_system        xp_system
  370. X
  371. X#define filename2        fn2
  372. X#define forward            forwrd
  373. X
  374. X#define generate_reply_to    gen_reply_to
  375. X#define get_return_name        g_ret_name
  376. X
  377. X#define header_line        h_line
  378. X#define header_page        h_page
  379. X#define headers_per_page    h_per_page
  380. X#define headers                 hdrs
  381. X
  382. X#define install_aliases        ins_aliases
  383. X
  384. X#define last_line_loc        last_ln_loc
  385. X
  386. X#define machine_group        mach_group
  387. X#define mailbox_defined        mbox_defined
  388. X#define mailfile_size        mfile_size
  389. X#define message_count        msg_count
  390. X#define message_number        msg_number
  391. X
  392. X#define newaliases        nwaliases
  393. X#define noptimize_return    noret_opt
  394. X#define noptimize_usenet    nousenet_opt
  395. X
  396. X#define optimize_and_add    opt_and_add
  397. X#define optimize_arpa        opt_arpa
  398. X#define optimize_cmplx_arpa    opt_cmplx_arpa
  399. X#define optimize_return        opt_return
  400. X#define optimize_usenet        opt_usenet
  401. X#define optional_arg        opt_arg
  402. X#define optionally_enter    opt_enter
  403. X#define original_cc        orig_cc
  404. X#define original_msg_num    orig_msg_num
  405. X#define original_to        orig_to
  406. X
  407. X#define parse_arguments        pars_arguments
  408. X#define parse_arpa_from        prs_arpa_from
  409. X#define password_entry        pw_entry
  410. X#define pattern_enter        pat_enter
  411. X#define pattern_match        pat_match
  412. X
  413. X#define read_alias_files    rd_alias_files
  414. X#define read_headers        rd_headers
  415. X#define read_rc            rd_rc
  416. X#define read_rc_file        rd_rc_file
  417. X#define received_on_machine    rcvd_on_machine
  418. X#define remove_all        rem_all
  419. X#define remove_first_word    rem_1st_word
  420. X#define remove_domains        rem_domains
  421. X#define remove_header        rem_hdr
  422. X#define remove_user        rem_user
  423. X#define remove_through_ch    rem_thru_ch
  424. X#define reply_to_everyone    repl_to_everyone
  425. X#define resolve_received    rslv_received
  426. X
  427. X#define show_message        shw_message
  428. X#define show_msg        showmsg
  429. X#define show_msg_tag        sh_msg_tag
  430. X#define size_of_pathfd        sz_of_pathfd
  431. X#define softkeys_off        soft_off
  432. X#define softkeys_on        soft_on
  433. X#define subjectbuffer        subjbuff
  434. X#define subject_matches        subj_matches
  435. X#define system_call        sys_call
  436. X#define system_data        sys_data
  437. X#define system_files        sys_files
  438. X#define system_hash_table    sys_hash_table
  439. X#define system_record        sys_record
  440. X
  441. X#define tail_of_string        tl_of_string
  442. X#define talk_to_sys        tlk_to_sys
  443. X#define tempfile        tmpfile
  444. X#define termcap_label        tcap_label
  445. X#define top_of_screen_left    top_left_of_screen
  446. X#define top_of_screen_right    top_right_of_screen
  447. X#define translate_return    xlate_return
  448. X
  449. X#define update_mailtime        upd_mailtime
  450. X#define update_title        upd_title
  451. X#define unexpanded_cc        unexp_cc
  452. X#define unexpanded_to        unexp_to
  453. X
  454. X#define verify_transmission    vfy_xmsn
  455. X
  456. X#define weeding_out        wding_out
  457. SHAR_EOF
  458. chmod 0444 hdrs/shortname.h || echo "restore of hdrs/shortname.h fails"
  459. echo "x - extracting hdrs/sysdefs.SH (Text)"
  460. sed 's/^X//' << 'SHAR_EOF' > hdrs/sysdefs.SH &&
  461. Xcase $CONFIG in
  462. X'')
  463. X    if test ! -f config.sh; then
  464. X    ln ../config.sh . || \
  465. X    ln ../../config.sh . || \
  466. X    ln ../../../config.sh . || \
  467. X    (echo "Can't find config.sh."; exit 1)
  468. X    echo "Using config.sh from above..."
  469. X    fi
  470. X    . ./config.sh
  471. X    ;;
  472. Xesac
  473. Xecho "Extracting hdrs/sysdefs.h (with variable substitutions)"
  474. Xsed <<!GROK!THIS! >sysdefs.h -e 's!^#undef!/\*#undef!'
  475. X/* $Id: sysdefs.SH,v 2.12 89/03/25 21:45:37 syd Exp $ */
  476. X/*******************************************************************************
  477. X *  The Elm Mail System  -  $Revision: 2.12 $   $State: Exp $
  478. X *
  479. X *             Copyright (c) 1986, 1987 Dave Taylor
  480. X *             Copyright (c) 1988, 1989 USENET Community Trust
  481. X *******************************************************************************
  482. X * Bug reports, patches, comments, suggestions should be sent to:
  483. X *
  484. X *    Syd Weinstein, Elm Coordinator
  485. X *    elm@dsinc.UUCP            dsinc!elm
  486. X *
  487. X *******************************************************************************
  488. X * $Log:    sysdefs.SH,v $
  489. X * Revision 2.12  89/03/25  21:45:37  syd
  490. X * Initial 2.2 Release checkin
  491. X * 
  492. X *
  493. X ******************************************************************************/
  494. X
  495. X/**  System level, configurable, defines for the ELM mail system.  **/
  496. X
  497. X
  498. X#define FIND_DELTA    10        /* byte region where the binary search
  499. X                       on the path alias file is fruitless 
  500. X                                           (can't be within this boundary)    */
  501. X
  502. X#define MAX_IN_WEEDLIST 150    /* max headers to weed out               */
  503. X
  504. X#define MAX_HOPS    35    /* max hops in return addr to E)veryone  */
  505. X
  506. X#define DEFAULT_BATCH_SUBJECT  "$defbatsub"
  507. X
  508. X#define DEFAULT_DOMAIN  "$mydomain"  /* if mydomain file is missing */
  509. X
  510. X/** If you want to implement 'site hiding' in the mail, then you'll need to
  511. X    uncomment the following lines and set them to reasonable values.  See 
  512. X    the configuration guide for more details....(actually these are undoc-
  513. X    umented because they're fairly dangerous to use.  Just ignore 'em and
  514. X    perhaps one day you'll find out what they do, ok?)
  515. X**/
  516. X
  517. X/****************************************************************************
  518. X
  519. X#define   SITE_HIDING
  520. X#define   HIDDEN_SITE_NAME    "fake-machine-name"
  521. X#define   HIDDEN_SITE_USERS    "/usr/mail/lists/hidden_site_users"
  522. X
  523. X****************************************************************************/
  524. X
  525. X#define system_text_file        "$lib/aliases.text"
  526. X#define system_hash_file        "$lib/aliases.hash"
  527. X#define system_data_file        "$lib/aliases.data"
  528. X
  529. X#define ALIAS_TEXT        ".elm/aliases.text"
  530. X#define ALIAS_HASH        ".elm/aliases.hash"
  531. X#define ALIAS_DATA        ".elm/aliases.data"
  532. X
  533. X#define pathfile        "$pathalias"
  534. X#define domains            "$domains"
  535. X#define hostdomfile             "$lib/domain"
  536. X
  537. X#define Lsys            "$lsysfile"
  538. X
  539. X/** where to put the output of the elm -d command... (in home dir) **/
  540. X#define DEBUGFILE    "ELM:debug.info"
  541. X#define OLDEBUG        "ELM:debug.last"
  542. X
  543. X#define    temp_dir       "$tmpdir/"
  544. X#define temp_file    "$tmpdir/snd."
  545. X#define temp_form_file    "$tmpdir/form."
  546. X#define temp_mbox    "$tmpdir/mbox."
  547. X#define temp_print      "$tmpdir/print."
  548. X#define temp_edit    "$tmpdir/elm-edit"
  549. X#define temp_uuname    "$tmpdir/uuname."
  550. X#define readmsg_file    ".elm/readmsg"
  551. X
  552. X#define emacs_editor    "$emacs"
  553. X
  554. X#define default_editor    "$defeditor"
  555. X#define mailhome    "$maildir/"
  556. X
  557. X#define default_shell    "$prefshell"
  558. X#define default_pager    "$pager"
  559. X#define default_printout    "$cat %s | $linepr"
  560. X
  561. X#define sendmail    "$sendmail"
  562. X#define smflags        "-oi -oem"    /* ignore dots and mail back errors */
  563. X#define smflagsv      "-oi -oem -v"   /* Verbose voyuer mode */
  564. X#define mailer        "$mailer"
  565. X
  566. X#define mailx        "$mailx"
  567. X
  568. X#define helphome    "$lib"
  569. X#define helpfile    "elm-help"
  570. X
  571. X#define ELMRC_INFO    "$lib/elmrc-info"
  572. X
  573. X#define elmrcfile    ".elm/elmrc"
  574. X#define old_elmrcfile    ".elm/elmrc.old"
  575. X#define mailheaders    ".elm/elmheaders"
  576. X#define dead_letter    "Cancelled.mail"
  577. X
  578. X#define unedited_mail    "emergency.mbox"
  579. X
  580. X#define newalias    "newalias 1>&2 > /dev/null"
  581. X#define readmsg        "readmsg"
  582. X
  583. X#define remove_cmd    "$rm -f"    /* how to remove a file */
  584. X#define cat        "$cat"        /* how to display files */
  585. X#define sed_cmd        "$sed"        /* how to access sed */
  586. X#define move_cmd    "$mv"        /* how to access sed */
  587. X#define uuname        "$uuname"    /* how to get a uuname  */
  588. X!GROK!THIS!
  589. SHAR_EOF
  590. chmod 0444 hdrs/sysdefs.SH || echo "restore of hdrs/sysdefs.SH fails"
  591. echo "x - extracting src/Makefile.SH (Text)"
  592. sed 's/^X//' << 'SHAR_EOF' > src/Makefile.SH &&
  593. Xcase $CONFIG in
  594. X'')
  595. X    if test ! -f config.sh; then
  596. X    ln ../config.sh . || \
  597. X    ln ../../config.sh . || \
  598. X    ln ../../../config.sh . || \
  599. X    (echo "Can't find config.sh."; exit 1)
  600. X    fi
  601. X    . ./config.sh
  602. X    ;;
  603. Xesac
  604. Xcase "$0" in
  605. X*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
  606. Xesac
  607. X
  608. Xecho "Extracting src/Makefile (with variable substitutions)"
  609. Xcat >Makefile <<!GROK!THIS!
  610. X# $Id: Makefile.SH,v 2.15 89/03/25 21:45:38 syd Exp $
  611. X#
  612. X#  Makefile for the ELM mail program.
  613. X#
  614. X#    Copyright (c) 1986, 1987 Dave Taylor
  615. X#    Copyright (c) 1988, 1989 USENET Community Trust
  616. X#
  617. X# Bug reports, patches, comments, suggestions should be sent to:
  618. X#
  619. X#    Syd Weinstein - elm@dsinc.UUCP
  620. X#            dsinc!elm
  621. X#
  622. X# $Log:    Makefile.SH,v $
  623. X# Revision 2.15  89/03/25  21:45:38  syd
  624. X# Initial 2.2 Release checkin
  625. X# 
  626. X#
  627. X# Variables
  628. X#    Variables established by Configure
  629. XCC        =    $cc
  630. XCCFLAGS        =    $ccflags $xencf
  631. XCHGRP        =    $chgrp
  632. XCHMOD        =    $chmod
  633. XCP        =    $cp
  634. XDEST        =    $bin
  635. XECHO        =    $echo
  636. XLFLAGS        =    $ldflags $xenlf
  637. XLIB        =    $lib
  638. XLIB2        =     $libs
  639. XLIBS        =    $cryptlib $termlib $dbm
  640. XLINT        =    $lint
  641. XMAILGRP        =    $mailgrp
  642. XMAILERMODE    =    $mailermode
  643. XMV        =    $mv
  644. XOPTIMIZE    =    $optimize
  645. XRM        =     $rm -f
  646. XTOUCH        =    $touch
  647. X
  648. X!GROK!THIS!
  649. X
  650. Xcat >>Makefile <<'!NO!SUBS!'
  651. X
  652. X#    Variables you may want to manually edit
  653. X#        If you want debug logging then you'll
  654. X#        want to uncomment the following.
  655. X#DEBUG        =    -DDEBUG
  656. X
  657. X#        If you're on an ACSnet system (Australia) then
  658. X#        you'll want to uncomment the following.
  659. X# DACSNET    =    -DACSNET
  660. X
  661. X#    Other general variables
  662. XBIN        =    ../bin
  663. XCFLAGS        =    $(CCFLAGS) $(OPTIMIZE) -I$(INCLDIR) $(DEBUG) $(DACSNET) 
  664. XINCLDIR        =    ../hdrs
  665. XLINTFLAGS    =    -I$(INCLDIR)
  666. XSHELL        =    /bin/sh
  667. X
  668. X#     Lists
  669. XELM_SRC        =    addr_util.c    \
  670. X            alias.c        \
  671. X            aliasdb.c    \
  672. X            aliaslib.c    \
  673. X            args.c        \
  674. X            bouncebk.c    \
  675. X            builtin.c    \
  676. X            calendar.c    \
  677. X            conn_to.c    \
  678. X            curses.c    \
  679. X            date.c        \
  680. X            delete.c    \
  681. X            domains.c    \
  682. X            edit.c        \
  683. X            editmsg.c    \
  684. X            elm.c        \
  685. X            encode.c    \
  686. X            errno.c        \
  687. X            expires.c    \
  688. X            file.c        \
  689. X            file_util.c    \
  690. X            fileio.c    \
  691. X            forms.c        \
  692. X            hdrconfg.c    \
  693. X            help.c        \
  694. X            init.c        \
  695. X            in_utils.c    \
  696. X            leavembox.c    \
  697. X            limit.c        \
  698. X            mailmsg1.c    \
  699. X            mailmsg2.c    \
  700. X            mailtime.c    \
  701. X            mkhdrs.c    \
  702. X            newmbox.c    \
  703. X            opt_utils.c    \
  704. X            options.c    \
  705. X            out_utils.c    \
  706. X            pattern.c    \
  707. X            pmalloc.c    \
  708. X            quit.c        \
  709. X            read_rc.c    \
  710. X            remail.c    \
  711. X            reply.c        \
  712. X            returnadd.c    \
  713. X            save_opts.c    \
  714. X            savecopy.c    \
  715. X            screen.c    \
  716. X            showmsg.c    \
  717. X            showmsg_c.c    \
  718. X            signals.c    \
  719. X            softkeys.c    \
  720. X            sort.c        \
  721. X            string2.c    \
  722. X            strings.c    \
  723. X            syscall.c    \
  724. X            utils.c        \
  725. X            validname.c
  726. X
  727. XELM_OBJ        =    addr_util.o    \
  728. X            alias.o        \
  729. X            aliasdb.o    \
  730. X            aliaslib.o    \
  731. X            args.o        \
  732. X            bouncebk.o    \
  733. X            builtin.o    \
  734. X            calendar.o    \
  735. X            conn_to.o    \
  736. X            curses.o    \
  737. X            date.o        \
  738. X            delete.o    \
  739. X            domains.o    \
  740. X            edit.o        \
  741. X            editmsg.o    \
  742. X            elm.o        \
  743. X            encode.o    \
  744. X            errno.o        \
  745. X            expires.o    \
  746. X            file.o        \
  747. X            file_util.o    \
  748. X            fileio.o    \
  749. X            forms.o        \
  750. X            hdrconfg.o    \
  751. X            help.o        \
  752. X            init.o        \
  753. X            in_utils.o    \
  754. X            leavembox.o    \
  755. X            limit.o        \
  756. X            mailmsg1.o    \
  757. X            mailmsg2.o    \
  758. X            mailtime.o    \
  759. X            mkhdrs.o    \
  760. X            newmbox.o    \
  761. X            opt_utils.o    \
  762. X            options.o    \
  763. X            out_utils.o    \
  764. X            pattern.o    \
  765. X            pmalloc.o    \
  766. X            quit.o        \
  767. X            read_rc.o    \
  768. X            remail.o    \
  769. X            reply.o        \
  770. X            returnadd.o    \
  771. X            save_opts.o    \
  772. X            savecopy.o    \
  773. X            screen.o    \
  774. X            showmsg.o    \
  775. X            showmsg_c.o    \
  776. X            signals.o    \
  777. X            softkeys.o    \
  778. X            sort.o        \
  779. X            string2.o    \
  780. X            strings.o    \
  781. X            syscall.o    \
  782. X            utils.o        \
  783. X            validname.o
  784. X
  785. X# Standard targets
  786. Xall:        $(BIN)/elm
  787. X
  788. Xinstall:    $(DEST)/elm
  789. X
  790. Xuninstall:    
  791. X        $(RM) $(DEST)/elm
  792. X
  793. X#    This is the only target that gets installed even if not out-of-date
  794. X#    with respect the files from which it is installed.
  795. Xrmt-install:    rmt-defined
  796. X        -$(MV) $(DEST)/elm $(DEST)/elm.old
  797. X        -$(RM) $(DEST)/elm.old
  798. X        $(CP) $(REMOTE)$(DEST)/elm $(DEST)/elm
  799. X        $(CHGRP) $(MAILGRP) $(DEST)/elm
  800. X        $(CHMOD) $(MAILERMODE) $(DEST)/elm
  801. X
  802. Xrmt-defined:
  803. X    @(if [ "$(REMOTE)" = "" ];\
  804. X      then\
  805. X        $(ECHO) "You need to define 'REMOTE' as the remote file system";\
  806. X        $(ECHO) "for this particular command. The easiest way to do this";\
  807. X        $(ECHO) "to type:";\
  808. X        $(ECHO) "        make REMOTE=<remote file system> rmt-install";\
  809. X        exit 1;\
  810. X    fi);
  811. X
  812. Xlint:        
  813. X        $(LINT) $(LINTFLAGS) $(ELM_SRC) > LINT.OUT
  814. X
  815. Xclean:        
  816. X        $(RM) $(ELM_OBJ) $(BIN)/elm
  817. X
  818. X# Dependencies and rules
  819. X#    Dependencies of header files upon other header files they include
  820. X$(INCLDIR)/defs.h:    $(INCLDIR)/../config.h $(INCLDIR)/sysdefs.h
  821. X            $(CHMOD) u+w $@
  822. X            $(TOUCH) $@
  823. X
  824. X$(INCLDIR)/elm.h:    $(INCLDIR)/curses.h $(INCLDIR)/defs.h
  825. X            $(CHMOD) u+w $@
  826. X            $(TOUCH) $@
  827. X
  828. X$(INCLDIR)/headers.h:    $(INCLDIR)/curses.h $(INCLDIR)/defs.h
  829. X            $(CHMOD) u+w $@
  830. X            $(TOUCH) $@
  831. X
  832. X#    Dependencies of C object files
  833. Xaddr_util.o:    $(INCLDIR)/headers.h
  834. Xalias.o:    $(INCLDIR)/headers.h
  835. Xaliasdb.o:    $(INCLDIR)/headers.h
  836. Xaliaslib.o:    $(INCLDIR)/headers.h
  837. Xargs.o:        $(INCLDIR)/headers.h
  838. Xbouncebk.o:    $(INCLDIR)/headers.h
  839. Xbuiltin.o:    $(INCLDIR)/headers.h
  840. Xcalendar.o:    $(INCLDIR)/headers.h
  841. Xconn_to.o:    $(INCLDIR)/headers.h
  842. Xcurses.o:    $(INCLDIR)/headers.h
  843. Xdate.o:        $(INCLDIR)/headers.h
  844. Xdelete.o:    $(INCLDIR)/headers.h
  845. Xdomains.o:    $(INCLDIR)/headers.h
  846. Xedit.o:        $(INCLDIR)/headers.h
  847. Xeditmsg.o:    $(INCLDIR)/headers.h
  848. Xelm.o:        $(INCLDIR)/elm.h
  849. Xencode.o:    $(INCLDIR)/headers.h
  850. Xerrno.o:    $(INCLDIR)/headers.h
  851. Xexpires.o:    $(INCLDIR)/headers.h
  852. Xfile.o:        $(INCLDIR)/headers.h
  853. Xfile_util.o:    $(INCLDIR)/headers.h
  854. Xfileio.o:    $(INCLDIR)/headers.h
  855. Xforms.o:    $(INCLDIR)/headers.h
  856. Xhdrconfg.o:    $(INCLDIR)/headers.h
  857. Xhelp.o:        $(INCLDIR)/headers.h
  858. Xin_utils.o:    $(INCLDIR)/headers.h
  859. Xinit.o:        $(INCLDIR)/headers.h $(INCLDIR)/patchlevel.h
  860. Xleavembox.o:    $(INCLDIR)/headers.h
  861. Xlimit.o:    $(INCLDIR)/headers.h
  862. Xmailmsg1.o:    $(INCLDIR)/headers.h
  863. Xmailmsg2.o:    $(INCLDIR)/headers.h
  864. Xmailtime.o:    $(INCLDIR)/headers.h
  865. Xmkhdrs.o:    $(INCLDIR)/headers.h
  866. Xnewmbox.o:    $(INCLDIR)/headers.h
  867. Xopt_utils.o:    $(INCLDIR)/headers.h
  868. Xoptions.o:    $(INCLDIR)/headers.h
  869. Xout_utils.o:    $(INCLDIR)/headers.h
  870. Xpattern.o:    $(INCLDIR)/headers.h
  871. Xpmalloc.o:    $(INCLDIR)/defs.h
  872. Xquit.o:        $(INCLDIR)/headers.h
  873. Xread_rc.o:    $(INCLDIR)/headers.h
  874. Xremail.o:    $(INCLDIR)/headers.h
  875. Xreply.o:    $(INCLDIR)/headers.h
  876. Xreturnadd.o:    $(INCLDIR)/headers.h
  877. Xsave_opts.o:    $(INCLDIR)/save_opts.h $(INCLDIR)/headers.h
  878. Xsavecopy.o:    $(INCLDIR)/headers.h
  879. Xscreen.o:    $(INCLDIR)/headers.h
  880. Xshowmsg.o:    $(INCLDIR)/headers.h
  881. Xshowmsg_c.o:    $(INCLDIR)/headers.h
  882. Xsignals.o:    $(INCLDIR)/headers.h
  883. Xsoftkeys.o:    $(INCLDIR)/headers.h
  884. Xsort.o:        $(INCLDIR)/headers.h
  885. Xstrings.o:    $(INCLDIR)/headers.h
  886. Xsyscall.o:    $(INCLDIR)/headers.h
  887. Xutils.o:    $(INCLDIR)/headers.h
  888. Xvalidname.o:    $(INCLDIR)/defs.h
  889. X
  890. X#    Dependencies and rules for compiling C programs
  891. X$(BIN)/elm:    $& $(ELM_OBJ)
  892. X        $(CC) $(LFLAGS) -o $@ $(ELM_OBJ) $(LIBS) $(LIB2)
  893. X
  894. X#    Dependencies and rules for installing C programs
  895. X$(DEST)/elm:    $(BIN)/elm
  896. X        -$(MV) $@ $@.old
  897. X        -$(RM) $@.old
  898. X        $(CP) $(BIN)/elm $@
  899. X        $(CHGRP) $(MAILGRP) $@
  900. X        $(CHMOD) $(MAILERMODE) $@
  901. X
  902. X!NO!SUBS!
  903. SHAR_EOF
  904. chmod 0444 src/Makefile.SH || echo "restore of src/Makefile.SH fails"
  905. echo "x - extracting src/addr_util.c (Text)"
  906. sed 's/^X//' << 'SHAR_EOF' > src/addr_util.c &&
  907. X
  908. Xstatic char rcsid[] = "@(#)$Id: addr_util.c,v 2.15 89/03/25 21:45:40 syd Exp $";
  909. X
  910. X/*******************************************************************************
  911. X *  The Elm Mail System  -  $Revision: 2.15 $   $State: Exp $
  912. X *
  913. X *             Copyright (c) 1986, 1987 Dave Taylor
  914. X *             Copyright (c) 1988, 1989 USENET Community Trust
  915. X *******************************************************************************
  916. X * Bug reports, patches, comments, suggestions should be sent to:
  917. X *
  918. X *    Syd Weinstein, Elm Coordinator
  919. X *    elm@dsinc.UUCP            dsinc!elm
  920. X *
  921. X *******************************************************************************
  922. X * $Log:    addr_util.c,v $
  923. X * Revision 2.15  89/03/25  21:45:40  syd
  924. X * Initial 2.2 Release checkin
  925. X * 
  926. X *
  927. X ******************************************************************************/
  928. X
  929. X/** This file contains addressing utilities 
  930. X
  931. X**/
  932. X
  933. X#include "headers.h"
  934. X
  935. X#include <sys/types.h>
  936. X#include <sys/stat.h>
  937. X#ifdef PWDINSYS
  938. X#  include <sys/pwd.h>
  939. X#else
  940. X#  include <pwd.h>
  941. X#endif
  942. X
  943. X#include <ctype.h>
  944. X
  945. X#ifdef BSD 
  946. X#undef tolower
  947. X#undef toupper
  948. X#endif
  949. X
  950. Xchar *shift_lower(), *get_alias_address(), *get_token(), *strtok(),
  951. X     *strchr(), *strcpy(), *strcat(), *strncpy();
  952. X
  953. Xchar *
  954. Xgcos_name(gcos_field, logname)
  955. Xchar *logname, *gcos_field;
  956. X{
  957. X    /** Return the full name found in a passwd file gcos field **/
  958. X
  959. X#ifdef BERKNAMES
  960. X
  961. X    static char fullname[SLEN];
  962. X    register char *fncp, *gcoscp, *lncp, *end;
  963. X
  964. X
  965. X    /* full name is all chars up to first ',' (or whole gcos, if no ',') */
  966. X    /* replace any & with logname in upper case */
  967. X
  968. X    for(fncp = fullname, gcoscp= gcos_field, end = fullname + SLEN - 1;
  969. X        (*gcoscp != ',' && *gcoscp != '\0' && fncp != end);
  970. X    gcoscp++) {
  971. X
  972. X    if(*gcoscp == '&') {
  973. X        for(lncp = logname; *lncp; fncp++, lncp++)
  974. X        *fncp = toupper(*lncp);
  975. X    } else {
  976. X        *fncp++ = *gcoscp;
  977. X    }
  978. X    }
  979. X    
  980. X    *fncp = '\0';
  981. X    return(fullname);
  982. X#else
  983. X#ifdef USGNAMES
  984. X
  985. X    char *firstcp, *lastcp;
  986. X
  987. X    /* The last character of the full name is the one preceding the first
  988. X     * '('. If there is no '(', then the full name ends at the end of the
  989. X     * gcos field.
  990. X     */
  991. X    if(lastcp = strchr(gcos_field, '('))
  992. X    *lastcp = '\0';
  993. X
  994. X    /* The first character of the full name is the one following the 
  995. X     * last '-' before that ending character. NOTE: that's why we
  996. X     * establish the ending character first!
  997. X     * If there is no '-' before the ending character, then the fullname
  998. X     * begins at the beginning of the gcos field.
  999. X     */
  1000. X    if(firstcp = strrchr(gcos_field, '-'))
  1001. X    firstcp++;
  1002. X    else
  1003. X    firstcp = gcos_field;
  1004. X
  1005. X    return(firstcp);
  1006. X
  1007. X#else
  1008. X    /* use full gcos field */
  1009. X    return(gcos_field);
  1010. X#endif
  1011. X#endif
  1012. X}
  1013. X        
  1014. Xchar *
  1015. Xget_full_name(logname)
  1016. Xchar *logname;
  1017. X{
  1018. X    /* return a pointer to the full user name for the passed logname
  1019. X     * or NULL if cannot be found
  1020. X     * If PASSNAMES get it from the gcos field, otherwise get it
  1021. X     * from ~/.fullname.
  1022. X     */
  1023. X
  1024. X    FILE *fp;
  1025. X    static char fullname[SLEN];
  1026. X    char fullnamefile[SLEN];
  1027. X    struct passwd *getpwnam(), *pass;
  1028. X
  1029. X    if((pass = getpwnam(logname)) == NULL)
  1030. X      return(NULL);
  1031. X#ifdef PASSNAMES    /* get full_username from gcos field */
  1032. X    strcpy(fullname, gcos_name(pass->pw_gecos, logname));
  1033. X#else            /* get full_username from ~/.fullname file */
  1034. X    sprintf(fullnamefile, "%s/.fullname", pass->pw_dir);
  1035. X
  1036. X    if(can_access(fullnamefile, READ_ACCESS) != 0)
  1037. X      return(NULL);        /* fullname file not accessible to user */
  1038. X    if((fp = fopen(fullnamefile, "r")) == NULL)
  1039. X      return(NULL);        /* fullname file cannot be opened! */
  1040. X    if(fgets(fullname, SLEN, fp) == NULL) {
  1041. X      fclose(fp);
  1042. X      return(NULL);        /* fullname file empty! */
  1043. X    }
  1044. X    fclose(fp);
  1045. X    no_ret(fullname);    /* remove trailing '\n' */
  1046. X#endif
  1047. X    return(fullname);
  1048. X}
  1049. X
  1050. Xint
  1051. Xtalk_to(sitename)
  1052. Xchar *sitename;
  1053. X{
  1054. X    /** If we talk to the specified site, return true, else
  1055. X        we're going to have to expand this baby out, so 
  1056. X        return false! **/
  1057. X
  1058. X    struct lsys_rec  *sysname;
  1059. X
  1060. X    sysname = talk_to_sys;
  1061. X
  1062. X    if (sysname == NULL) {
  1063. X     dprint(2, (debugfile, 
  1064. X        "Warning: talk_to_sys is currently set to NULL!\n"));
  1065. X     return(0);
  1066. X    }
  1067. X
  1068. X    while (sysname != NULL) {
  1069. X      if (strcmp(sysname->name, sitename) == 0)
  1070. X        return(1);
  1071. X      else
  1072. X        sysname = sysname->next;
  1073. X    }
  1074. X
  1075. X    return(0);
  1076. X}
  1077. X
  1078. Xadd_site(buffer, site, lastsite)
  1079. Xchar *buffer, *site, *lastsite;
  1080. X{
  1081. X    /** add site to buffer, unless site is 'uucp', current machine, or
  1082. X            site is the same as lastsite.   If not, set lastsite to
  1083. X            site.
  1084. X    **/
  1085. X
  1086. X    char local_buffer[SLEN];
  1087. X    char *strip_parens();
  1088. X
  1089. X    if (strcmp(site, "uucp") != 0)
  1090. X      if (strcmp(site, lastsite) != 0) 
  1091. X        if (strcmp(site, hostname) != 0) {
  1092. X          if (buffer[0] == '\0')
  1093. X            strcpy(buffer, strip_parens(site));         /* first in list! */
  1094. X          else {
  1095. X            sprintf(local_buffer,"%s!%s", buffer, strip_parens(site));
  1096. X            strcpy(buffer, local_buffer);
  1097. X          }
  1098. X          strcpy(lastsite, strip_parens(site)); /* don't want THIS twice! */
  1099. X        }
  1100. X}
  1101. X
  1102. X#ifdef USE_EMBEDDED_ADDRESSES
  1103. X
  1104. Xget_address_from(prefix, line, buffer)
  1105. Xchar *prefix, *line, *buffer;
  1106. X{
  1107. X    /** This routine extracts the address from either a 'From:' line
  1108. X        or a 'Reply-To:' line...the algorithm is quite simple, too:
  1109. X        increment 'line' past header, then check last character of 
  1110. X        line.  If it's a '>' then the address is contained within '<>'
  1111. X        and if it's a ')' then the address is in the 'clear'... **/
  1112. X
  1113. X    register int i, j = 0;
  1114. X    
  1115. X    no_ret(line);
  1116. X
  1117. X    line = (char *) (line + strlen(prefix) + 1);
  1118. X
  1119. X    if (line[strlen(line)-1] == '>') {
  1120. X      for (i=strlen(line)-2; i > -1 && line[i] != '<'; i--)
  1121. X        buffer[j++] = line[i];
  1122. X      buffer[j] = 0;
  1123. X      reverse(buffer);
  1124. X    }
  1125. X    else {    /* either ')' or address in the clear... */
  1126. X      for (i=0; i < strlen(line) && line[i] != '('; i++)
  1127. X        buffer[j++] = line[i];
  1128. X      if (buffer[j-1] == '(') j--;
  1129. X      buffer[j] = 0;
  1130. X    }
  1131. X}
  1132. X
  1133. X#endif
  1134. X
  1135. Xtranslate_return(addr, ret_addr)
  1136. Xchar *addr, *ret_addr;
  1137. X{
  1138. X    /** Return ret_addr to be the same as addr, but with the login 
  1139. X            of the person sending the message replaced by '%s' for 
  1140. X            future processing... 
  1141. X        Fixed to make "%xx" "%%xx" (dumb 'C' system!) 
  1142. X    **/
  1143. X
  1144. X    register int loc, loc2, iindex = 0;
  1145. X    
  1146. X    loc2 = chloc(addr,'@');
  1147. X    if ((loc = chloc(addr, '%')) < loc2)
  1148. X      loc2 = loc;
  1149. X
  1150. X    if (loc2 != -1) {    /* ARPA address. */
  1151. X      /* algorithm is to get to '@' sign and move backwards until
  1152. X         we've hit the beginning of the word or another metachar.
  1153. X      */
  1154. X      for (loc = loc2 - 1; loc > -1 && addr[loc] != '!'; loc--)
  1155. X         ;
  1156. X    }
  1157. X    else {            /* usenet address */
  1158. X      /* simple algorithm - find last '!' */
  1159. X
  1160. X      loc2 = strlen(addr);    /* need it anyway! */
  1161. X
  1162. X      for (loc = loc2; loc > -1 && addr[loc] != '!'; loc--)
  1163. X          ;
  1164. X    }
  1165. X    
  1166. X    /** now copy up to 'loc' into destination... **/
  1167. X
  1168. X    while (iindex <= loc) {
  1169. X      ret_addr[iindex] = addr[iindex];
  1170. X      iindex++;
  1171. X    }
  1172. X
  1173. X    /** now append the '%s'... **/
  1174. X
  1175. X    ret_addr[iindex++] = '%';
  1176. X    ret_addr[iindex++] = 's';
  1177. X
  1178. X    /** and, finally, if anything left, add that **/
  1179. X
  1180. X    while (loc2 < strlen(addr)) {
  1181. X      ret_addr[iindex++] = addr[loc2++];
  1182. X      if (addr[loc2-1] == '%')    /* tweak for "printf" */
  1183. X        ret_addr[iindex++] = '%';
  1184. X    }
  1185. X    
  1186. X    ret_addr[iindex] = '\0';
  1187. X}
  1188. X
  1189. Xint
  1190. Xbuild_address(to, full_to)
  1191. Xchar *to, *full_to;
  1192. X{
  1193. X    /** loop on all words in 'to' line...append to full_to as
  1194. X        we go along, until done or length > len.  Modified to
  1195. X        know that stuff in parens are comments...Returns non-zero
  1196. X        if it changed the information as it copied it across...
  1197. X    **/
  1198. X
  1199. X    register int i, j, changed = 0, in_parens = 0, expanded_information = 0;
  1200. X    char word[SLEN], next_word[SLEN], *ptr, buffer[SLEN];
  1201. X    char new_to_list[SLEN];
  1202. X    char *strpbrk(), *expand_system(), *strcat(), *gecos;
  1203. X
  1204. X    new_to_list[0] = '\0';
  1205. X
  1206. X    i = get_word(to, 0, word);
  1207. X
  1208. X    full_to[0] = '\0';
  1209. X
  1210. X    while (i > 0) {
  1211. X
  1212. X      j = get_word(to, i, next_word);
  1213. X
  1214. Xtry_new_word:
  1215. X      if(word[0] == '(')
  1216. X        in_parens++;
  1217. X
  1218. X      if (in_parens) {
  1219. X        if(word[strlen(word)-1] == ')')
  1220. X          in_parens--;
  1221. X        strcat(full_to, " ");
  1222. X        strcat(full_to, word);
  1223. X      }
  1224. X      else if (strpbrk(word,"!@:") != NULL) {
  1225. X#ifdef DONT_TOUCH_ADDRESSES
  1226. X        sprintf(full_to, "%s%s%s", full_to,
  1227. X                    full_to[0] != '\0'? ", " : "", word);
  1228. X#else
  1229. X        sprintf(full_to, "%s%s%s", full_to,
  1230. X                    full_to[0] != '\0'? ", " : "", expand_system(word, 1));
  1231. X#endif
  1232. X      }
  1233. X      else if ((ptr = get_alias_address(word, 1, 0)) != NULL) {
  1234. X        sprintf(full_to, "%s%s%s", full_to, 
  1235. X                    full_to[0] != '\0'? ", " : "", ptr);
  1236. X        expanded_information++;
  1237. X      }
  1238. X      else if (strlen(word) > 0) {
  1239. X        if (valid_name(word)) {
  1240. X          if (j > 0 && next_word[0] == '(')    /* already has full name */
  1241. X        gecos = NULL;
  1242. X          else                /* needs a full name */
  1243. X        gecos=get_full_name(word);
  1244. X#ifdef USE_DOMAIN
  1245. X          sprintf(full_to, "%s%s%s@%s%s%s%s%s",
  1246. X              full_to,
  1247. X              (full_to[0] != '\0'? ", " : ""),
  1248. X              word,
  1249. X              hostname,
  1250. X              hostdomain,
  1251. X              (gecos ? " (" : ""),
  1252. X              (gecos ? gecos : ""),
  1253. X              (gecos ? ")" : ""));
  1254. X#else
  1255. X          sprintf(full_to, "%s%s%s%s%s%s",
  1256. X              full_to,
  1257. X              (full_to[0] != '\0'? ", " : ""),
  1258. X              word,
  1259. X              (gecos ? " (" : ""),
  1260. X              (gecos ? gecos : ""),
  1261. X              (gecos ? ")" : ""));
  1262. X#endif
  1263. X        } else if (check_only) {
  1264. X          printf("(alias \"%s\" is unknown)\n\r", word);
  1265. X          changed++;
  1266. X        }
  1267. X        else if (! isatty(fileno(stdin)) ) {    /* batch mode error! */
  1268. X          fprintf(stderr,"Cannot expand alias '%s'!\n\r", word);
  1269. X          fprintf(stderr,"Use \"checkalias\" to find valid addresses!\n\r");
  1270. X          dprint(1, (debugfile,
  1271. X              "Can't expand alias %s - bailing out of build_address\n", 
  1272. X              word));
  1273. X          leave(0);
  1274. X        }
  1275. X        else {
  1276. X          dprint(2,(debugfile,"Entered unknown address %s\n", word));
  1277. X          sprintf(buffer, "'%s' is an unknown address.  Replace with: ", 
  1278. X                  word);
  1279. X          word[0] = '\0';
  1280. X          changed++;
  1281. X
  1282. X          PutLine0(LINES, 0, buffer);
  1283. X        
  1284. X          (void)optionally_enter(word, LINES, strlen(buffer), FALSE, FALSE);
  1285. X          clear_error();
  1286. X          if (strlen(word) > 0) {
  1287. X            dprint(3,(debugfile, "Replaced with %s in build_address\n", 
  1288. X             word));
  1289. X        goto try_new_word;
  1290. X          }
  1291. X          else
  1292. X        dprint(3,(debugfile, 
  1293. X            "Address removed from TO list by build_address\n"));
  1294. X          continue;
  1295. X        }
  1296. X      }
  1297. X
  1298. X      /* and this word to the new to list */
  1299. X      if(*new_to_list != '\0')
  1300. X        strcat(new_to_list, " ");
  1301. X      strcat(new_to_list, word);
  1302. X
  1303. X      if((i = j) > 0)
  1304. X        strcpy(word, next_word);
  1305. X    }
  1306. X
  1307. X    /* if new to list is different from original, update original */
  1308. X    if (changed)
  1309. X      strcpy(to, new_to_list);
  1310. X
  1311. X    return( expanded_information > 0 ? 1 : 0 );
  1312. X}
  1313. X
  1314. Xint
  1315. Xreal_from(buffer, entry)
  1316. Xchar *buffer;
  1317. Xstruct header_rec *entry;
  1318. X{
  1319. X    /***** Returns true iff 's' has the seven 'from' fields, (or
  1320. X           8 - some machines include the TIME ZONE!!!)
  1321. X           Initialize the date and from entries in the record 
  1322. X           and also the message received date/time if 'entry'
  1323. X           is not NULL.  *****/
  1324. X
  1325. X    struct header_rec temp_rec, *rec_ptr;
  1326. X    char junk[STRING], timebuff[STRING], holding_from[SLEN];
  1327. X    int  eight_fields = 0;
  1328. X
  1329. X    /* set rec_ptr according to whether the data is to be returned
  1330. X     * in the second argument */
  1331. X    rec_ptr = (entry == NULL ? &temp_rec : entry);
  1332. X
  1333. X    rec_ptr->year[0] = '\0';
  1334. X    timebuff[0] = '\0';
  1335. X    junk[0] = '\0';
  1336. X
  1337. X    /* From <user> <day> <month> <day> <hr:min:sec> <year> */
  1338. X
  1339. X    sscanf(buffer, "%*s %*s %*s %*s %*s %s %*s %s", timebuff, junk);
  1340. X
  1341. X    if (strlen(timebuff) < 3) {
  1342. X      dprint(3,(debugfile, 
  1343. X        "Real_from returns FAIL [no time field] on\n-> %s\n", 
  1344. X        buffer));
  1345. X      return(FALSE);
  1346. X    }
  1347. X
  1348. X    if (timebuff[1] != ':' && timebuff[2] != ':') { 
  1349. X      dprint(3,(debugfile, 
  1350. X        "Real_from returns FAIL [bad time field] on\n-> %s\n", 
  1351. X        buffer));
  1352. X      return(FALSE);
  1353. X    }
  1354. X    if (junk[0] != '\0') {    /* try for 8 field entry */
  1355. X      junk[0] = '\0';
  1356. X      sscanf(buffer, "%*s %*s %*s %*s %*s %s %*s %*s %s", timebuff, junk);
  1357. X      if (junk[0] != '\0') {
  1358. X        dprint(3, (debugfile, 
  1359. X          "Real_from returns FAIL [too many fields] on\n-> %s\n", 
  1360. X          buffer));
  1361. X        return(FALSE);
  1362. X      }
  1363. X      eight_fields++;
  1364. X    }
  1365. X
  1366. X    /** now get the info out of the record! **/
  1367. X
  1368. X    if (eight_fields) 
  1369. X      sscanf(buffer, "%s %s %s %s %s %s %*s %s",
  1370. X                junk, holding_from, rec_ptr->dayname, rec_ptr->month, 
  1371. X                    rec_ptr->day, rec_ptr->time, rec_ptr->year);
  1372. X    else
  1373. X      sscanf(buffer, "%s %s %s %s %s %s %s",
  1374. X                junk, holding_from, rec_ptr->dayname, rec_ptr->month, 
  1375. X                    rec_ptr->day, rec_ptr->time, rec_ptr->year);
  1376. X    
  1377. X    strncpy(rec_ptr->from, holding_from, STRING-1);
  1378. X    rec_ptr->from[STRING-1] = '\0';
  1379. X    resolve_received(rec_ptr);
  1380. X    return(rec_ptr->year[0] != '\0');
  1381. X}
  1382. X
  1383. Xforwarded(buffer, entry)
  1384. Xchar *buffer;
  1385. Xstruct header_rec *entry;
  1386. X{
  1387. X    /** Change 'from' and date fields to reflect the ORIGINATOR of 
  1388. X        the message by iteratively parsing the >From fields... 
  1389. X        Modified to deal with headers that include the time zone
  1390. X        of the originating machine... **/
  1391. X
  1392. X    char machine[SLEN], buff[SLEN], holding_from[SLEN];
  1393. X
  1394. X    machine[0] = holding_from[0] = '\0';
  1395. X
  1396. X    sscanf(buffer, "%*s %s %s %s %s %s %s %*s %*s %s",
  1397. X                holding_from, entry->dayname, entry->month, 
  1398. X                    entry->day, entry->time, entry->year, machine);
  1399. X
  1400. X    if (isdigit(entry->month[0])) { /* try for veeger address */
  1401. X      sscanf(buffer, "%*s %s %s%*c %s %s %s %s %*s %*s %s",
  1402. X                holding_from, entry->dayname, entry->day, entry->month, 
  1403. X                    entry->year, entry->time, machine);
  1404. X    }
  1405. X    if (isalpha(entry->year[0])) { /* try for address including tz */
  1406. X      sscanf(buffer, "%*s %s %s %s %s %s %*s %s %*s %*s %s",
  1407. X                holding_from, entry->dayname, entry->month, 
  1408. X                    entry->day, entry->time, entry->year, machine);
  1409. X    }
  1410. X
  1411. X    /* the following fix is to deal with ">From xyz ... forwarded by xyz"
  1412. X       which occasionally shows up within AT&T.  Thanks to Bill Carpenter
  1413. X       for the fix! */
  1414. X
  1415. X    if (strcmp(machine, holding_from) == 0)
  1416. X      machine[0] = '\0';
  1417. X
  1418. X    if (machine[0] == '\0')
  1419. X      strcpy(buff, holding_from[0] ? holding_from : "anonymous");
  1420. X    else
  1421. X      sprintf(buff,"%s!%s", machine, holding_from);
  1422. X
  1423. X    strncpy(entry->from, buff, STRING-1);
  1424. X    entry->from[STRING-1] = '\0';
  1425. X}
  1426. X
  1427. Xparse_arpa_who(buffer, newfrom, is_really_a_to)
  1428. Xchar *buffer, *newfrom;
  1429. Xint is_really_a_to;
  1430. X{
  1431. X    /** try to parse the 'From:' line given... It can be in one of
  1432. X        two formats:
  1433. X        From: Dave Taylor <hplabs!dat>
  1434. X        or  From: hplabs!dat (Dave Taylor)
  1435. X
  1436. X        Added: removes quotes if name is quoted (12/12)
  1437. X        Added: only copies STRING characters...
  1438. X        Added: if no comment part, copy address instead! 
  1439. X        Added: if is_really_a_to, this is really a 'to' line
  1440. X           and treat as if we allow embedded addresses
  1441. X    **/
  1442. X
  1443. X    int use_embedded_addresses;
  1444. X    char temp_buffer[SLEN], *temp;
  1445. X    register int i, j = 0, in_parens;
  1446. X
  1447. X    temp = (char *) temp_buffer;
  1448. X    temp[0] = '\0';
  1449. X
  1450. X    no_ret(buffer);        /* blow away '\n' char! */
  1451. X
  1452. X    if (lastch(buffer) == '>') {
  1453. X      for (i=strlen("From: "); buffer[i] != '\0' && buffer[i] != '<' &&
  1454. X           buffer[i] != '('; i++)
  1455. X        temp[j++] = buffer[i];
  1456. X      temp[j] = '\0';
  1457. X    }
  1458. X    else if (lastch(buffer) == ')') {
  1459. X      in_parens = 1;
  1460. X      for (i=strlen(buffer)-2; buffer[i] != '\0' && buffer[i] != '<'; i--) {
  1461. X        switch(buffer[i]) {
  1462. X        case ')':    in_parens++;
  1463. X            break;
  1464. X        case '(':    in_parens--;
  1465. X            break;
  1466. X        }
  1467. X        if(!in_parens) break;
  1468. X        temp[j++] = buffer[i];
  1469. X      }
  1470. X      temp[j] = '\0';
  1471. X      reverse(temp);
  1472. X    }
  1473. X
  1474. X#ifdef USE_EMBEDDED_ADDRESSES
  1475. X    use_embedded_addresses = TRUE;
  1476. X#else
  1477. X    use_embedded_addresses = FALSE;
  1478. X#endif
  1479. X
  1480. X    if(use_embedded_addresses || is_really_a_to) {
  1481. X      /** if we have a null string at this point, we must just have a 
  1482. X          From: line that contains an address only.  At this point we
  1483. X          can have one of a few possibilities...
  1484. X
  1485. X          From: address
  1486. X          From: <address>
  1487. X          From: address ()
  1488. X      **/
  1489. X        
  1490. X      if (strlen(temp) == 0) {
  1491. X        if (lastch(buffer) != '>') {       
  1492. X          for (i=strlen("From:");buffer[i] != '\0' && buffer[i] != '('; i++)
  1493. X        temp[j++] = buffer[i];
  1494. X          temp[j] = '\0';
  1495. X        }
  1496. X        else {    /* get outta '<>' pair, please! */
  1497. X          for (i=strlen(buffer)-2;buffer[i] != '<' && buffer[i] != ':';i--)
  1498. X        temp[j++] = buffer[i];
  1499. X          temp[j] = '\0';
  1500. X          reverse(temp);
  1501. X        }
  1502. X      }
  1503. X    }
  1504. X      
  1505. X    if (strlen(temp) > 0) {        /* mess with buffer... */
  1506. X
  1507. X      /* remove leading spaces and quotes... */
  1508. X
  1509. X      while (whitespace(temp[0]) || quote(temp[0]))
  1510. X        temp = (char *) (temp + 1);        /* increment address! */
  1511. X
  1512. X      /* remove trailing spaces and quotes... */
  1513. X
  1514. X      i = strlen(temp) - 1;
  1515. X
  1516. X      while (whitespace(temp[i]) || quote(temp[i]))
  1517. X       temp[i--] = '\0';
  1518. X
  1519. X      /* if anything is left, let's change 'from' value! */
  1520. X
  1521. X      if (strlen(temp) > 0) {
  1522. X        strncpy(newfrom, temp, STRING-1);
  1523. X        newfrom[STRING-1] = '\0';
  1524. X      }
  1525. X    }
  1526. X}
  1527. X
  1528. Xparse_arpa_date(string, entry)
  1529. Xchar *string;
  1530. Xstruct header_rec *entry;
  1531. X{
  1532. X    /** Parse and figure out the given date format... return
  1533. X        the entry fields changed iff it turns out we have a
  1534. X        valid parse of the date!  **/
  1535. X
  1536. X    char word[15][WLEN], buffer[SLEN], *bufptr;
  1537. X    char *aword;
  1538. X    int  words = 0;
  1539. X
  1540. X    strcpy(buffer, string);
  1541. X    bufptr = (char *) buffer;
  1542. X
  1543. X    /** break the line down into words... **/
  1544. X
  1545. X    while ((aword = strtok(bufptr," \t '\"-/(),.")) != NULL) {
  1546. X      strcpy(word[words++], aword);
  1547. X      bufptr = NULL;
  1548. X    }
  1549. X
  1550. X    if (words < 6) {    /* strange format.  We're outta here! */
  1551. X      dprint(3,(debugfile, 
  1552. X        "Parse_arpa_date failed [less than six fields] on\n-> %s\n",
  1553. X        string));
  1554. X      return;
  1555. X    }
  1556. X
  1557. X    /* There are now five possible combinations that we could have:
  1558. X     
  1559. X        Date: day_number month_name year_number time timezone
  1560. X        Date: day_name day_number month_name year_number ...
  1561. X        Date: day_name month_name day_number time year_number
  1562. X        Date: day_name month_name day_number year_number time
  1563. X        Date: day_number month_name year_number time timezone day_name
  1564. X
  1565. X       Note that they are distinguishable by checking the first
  1566. X       character of the second, third and fourth words... 
  1567. X    */
  1568. X
  1569. X    if (isdigit(word[1][0])) {            /*** type one! ***/
  1570. X      if (! valid_date(word[1], word[2], word[3])) {
  1571. X        dprint(3,(debugfile, 
  1572. X          "parse_arpa_date failed [bad date: %s/%s/%s] on\n-> %s\n",
  1573. X          word[1], word[2], word[3], string));
  1574. X        return;        /* strange date! */
  1575. X      }
  1576. X      strncpy(entry->day, word[1], 2);
  1577. X      entry->day[2] = '\0';
  1578. X      strncpy(entry->month, word[2], 3);
  1579. X      entry->month[3] = '\0';
  1580. X      strncpy(entry->year,  word[3], 4);
  1581. X      entry->year[4] = '\0';
  1582. X      strncpy(entry->time,  word[4], 10);
  1583. X      entry->time[10] = '\0';
  1584. X    }
  1585. X    else if (isdigit(word[2][0])) {                /*** type two! ***/
  1586. X      if (! valid_date(word[2], word[3], word[4])) {
  1587. X        dprint(3,(debugfile,
  1588. X          "parse_arpa_date failed [bad date: %s/%s/%s] on\n-> %s\n",
  1589. X          word[2], word[3], word[4], string));
  1590. X        return;        /* strange date! */
  1591. X      }
  1592. X      strncpy(entry->day, word[2], 2);
  1593. X      entry->day[2] = '\0';
  1594. X      strncpy(entry->month, word[3], 3);
  1595. X      entry->month[3] = '\0';
  1596. X      strncpy(entry->year,  word[4], 4);
  1597. X      entry->year[4] = '\0';
  1598. X      strncpy(entry->time,  word[5], 10);
  1599. X      entry->time[10] = '\0';
  1600. X    }
  1601. X    else if (isdigit(word[3][0])) {        
  1602. X      if (word[4][1] == ':' || 
  1603. X              word[4][2] == ':') {                   /*** type three! ***/
  1604. X        if (! valid_date(word[3], word[2], word[5])) {
  1605. X         dprint(3, (debugfile,
  1606. X        "parse_arpa_date failed [bad date: %s/%s/%s] on\n-> %s\n",
  1607. X            word[3], word[2], word[5], string));
  1608. X          return;        /* strange date! */
  1609. X        }
  1610. X        strncpy(entry->year,  word[5], 4);
  1611. X        entry->year[4] = '\0';
  1612. X        strncpy(entry->time,  word[4], 10);
  1613. X        entry->time[10] = '\0';
  1614. X      }
  1615. X      else {                       /*** type four!  ***/ 
  1616. X        if (! valid_date(word[3], word[2], word[4])) {
  1617. X         dprint(3,(debugfile,
  1618. X            "parse_arpa_date failed [bad date: %s/%s/%s] on\n-> %s\n",
  1619. X            word[3], word[2], word[4], string));
  1620. X          return;        /* strange date! */
  1621. X        }
  1622. X        strncpy(entry->year,  word[4], 4);
  1623. X        entry->year[4] = '\0';
  1624. X        strncpy(entry->time, word[5], 10);
  1625. X        entry->time[10] = '\0';
  1626. X      }
  1627. X      strncpy(entry->day, word[3], 2);
  1628. X      entry->day[2] = '\0';
  1629. X      strncpy(entry->month, word[2], 3);
  1630. X      entry->month[3] = '\0';
  1631. X    }
  1632. X
  1633. X    /** finally, let's just normalize the monthname to be a three
  1634. X        letter abbreviation, with the first capitalized and the
  1635. X        second and third in lowercase... **/
  1636. X
  1637. X    shift_lower(entry->month);
  1638. X    entry->month[0] = toupper(entry->month[0]);
  1639. X}
  1640. X
  1641. Xfix_arpa_address(address)
  1642. Xchar *address;
  1643. X{
  1644. X    /** Given a pure ARPA address, try to make it reasonable.
  1645. X
  1646. X        This means that if you have something of the form a@b@b make 
  1647. X            it a@b.  If you have something like a%b%c%b@x make it a%b@x...
  1648. X    **/
  1649. X
  1650. X    register int host_count = 0, i;
  1651. X    char     hosts[MAX_HOPS][NLEN];    /* array of machine names */
  1652. X    char     *host, *addrptr;
  1653. X
  1654. X    /*  break down into a list of machine names, checking as we go along */
  1655. X    
  1656. X    addrptr = (char *) address;
  1657. X
  1658. X    while ((host = get_token(addrptr, "%@", 2)) != NULL) {
  1659. X      for (i = 0; i < host_count && ! equal(hosts[i], host); i++)
  1660. X          ;
  1661. X
  1662. X      if (i == host_count) {
  1663. X        strcpy(hosts[host_count++], host);
  1664. X        if (host_count == MAX_HOPS) {
  1665. X           dprint(2, (debugfile, 
  1666. X           "Can't build return address - hit MAX_HOPS in fix_arpa_address\n"));
  1667. X           error("Can't build return address - hit MAX_HOPS limit!");
  1668. X           return(1);
  1669. X        }
  1670. X      }
  1671. X      else 
  1672. X        host_count = i + 1;
  1673. X      addrptr = NULL;
  1674. X    }
  1675. X
  1676. X    /** rebuild the address.. **/
  1677. X
  1678. X    address[0] = '\0';
  1679. X
  1680. X    for (i = 0; i < host_count; i++)
  1681. X      sprintf(address, "%s%s%s", address, 
  1682. X              address[0] == '\0'? "" : 
  1683. X             (i == host_count - 1 ? "@" : "%"),
  1684. X              hosts[i]);
  1685. X
  1686. X    return(0);
  1687. X}
  1688. X
  1689. Xfigure_out_addressee(buffer, mail_to)
  1690. Xchar *buffer;
  1691. Xchar *mail_to;
  1692. X{
  1693. X    /** This routine steps through all the addresses in the "To:"
  1694. X        list, initially setting it to the first entry (if mail_to
  1695. X        is NULL) or, if the user is found (eg "alternatives") to
  1696. X        the current "username".
  1697. X
  1698. X        Modified to know how to read quoted names...
  1699. X        also modified to look for a comma or eol token and then
  1700. X        try to give the maximal useful information when giving the
  1701. X        default "to" entry (e.g. "Dave Taylor <taylor@hpldat>"
  1702. X        will now give "Dave Taylor" rather than just "Dave")
  1703. X    **/
  1704. X
  1705. X    char *address, *bufptr, mybuf[SLEN];
  1706. X    register int iindex = 0, index2 = 0;
  1707. X    
  1708. X    if (equal(mail_to, username)) return;    /* can't be better! */
  1709. X
  1710. X    bufptr = (char *) buffer;           /* use the string directly   */
  1711. X
  1712. X    if (strchr(buffer,'"') != NULL) {    /* we have a quoted string */
  1713. X      while (buffer[iindex] != '"')
  1714. X        iindex++;
  1715. X      iindex++;    /* skip the leading quote */
  1716. X      while (buffer[iindex] != '"' && iindex < strlen(buffer))
  1717. X        mail_to[index2++] = buffer[iindex++];
  1718. X      mail_to[index2] = '\0';
  1719. X    }
  1720. X
  1721. X    else  {
  1722. X
  1723. X      while ((address = strtok(bufptr, ",\t\n\r")) != NULL) {
  1724. X
  1725. X        if (! okay_address(address, "don't match me!")) {
  1726. X          strcpy(mail_to, username);    /* it's to YOU! */
  1727. X          return;
  1728. X        }
  1729. X        else if (strlen(mail_to) == 0) {    /* it's SOMEthing! */
  1730. X    
  1731. X          /** this next bit is kinda gory, but allows us to use the
  1732. X          existing routines to parse the address - by pretending
  1733. X          it's a From: line and going from there...
  1734. X              Ah well - you get what you pay for, right?
  1735. X          **/
  1736. X
  1737. X          if (strlen(address) > (sizeof mybuf) - 7)    /* ensure it ain't */
  1738. X        address[(sizeof mybuf)-7] = '\0';    /*  too long mon!  */
  1739. X
  1740. X          sprintf(mybuf, "From: %s", address);
  1741. X          parse_arpa_who(mybuf, mail_to, TRUE);
  1742. SHAR_EOF
  1743. echo "End of part 10"
  1744. echo "File src/addr_util.c is continued in part 11"
  1745. echo "11" > s2_seq_.tmp
  1746. exit 0
  1747.  
  1748.